Skip to content

fix: refactor update data to avoid lodash issues#2585

Open
sdirix wants to merge 1 commit into
masterfrom
fix-2397
Open

fix: refactor update data to avoid lodash issues#2585
sdirix wants to merge 1 commit into
masterfrom
fix-2397

Conversation

@sdirix
Copy link
Copy Markdown
Member

@sdirix sdirix commented May 28, 2026

Replace the lodash/fp/set call in UPDATE_DATA with a dedicated helper. This fixes issues with numeric segments (e.g. "group-key.15") and bracket characters in property names (e.g. "test[0]").

Fixes #2102
Fixes #2397

@sdirix sdirix requested a review from lucas-koehler May 28, 2026 15:09
@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2026

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 2d5506c
🔍 Latest deploy log https://app.netlify.com/projects/jsonforms-examples/deploys/6a1d597e0106da000871ada4
😎 Deploy Preview https://deploy-preview-2585--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coveralls
Copy link
Copy Markdown

coveralls commented May 28, 2026

Coverage Status

coverage: 83.058% (-0.05%) from 83.105% — fix-2397 into master

Replace the lodash/fp/set call in UPDATE_DATA with a dedicated helper.
This fixes issues with numeric segments (e.g. "group-key.15") and
bracket characters in property names (e.g. "test[0]").

Fixes #2102
Fixes #2397
Copy link
Copy Markdown
Contributor

@lucas-koehler lucas-koehler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me already 🚀
I have one minor concern inline. please have a look :)

Comment on lines +86 to +88
if (segments.length === 0) {
return value;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

''.split('.') returns [''], never [], so this guard is unreachable. An empty path falls through to assign(container, '', value), which writes to key ''.That happens to match the old lodash behavior (setFp('', v, {b:2}) → {b:2, '': v}), so it's not a regression, but the guard is misleading.

Should we drop it, or if the intent was to treat an empty path as "replace root", handle that explicitly?

Comment on lines +145 to +147
if (segments.length === 0) {
return data;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update data bug on nested property with numeric key Cannot enter values in field with brackets in property name

3 participants